package com.example.springbootrabbitmqconsumer.consumer;

import com.example.springbootrabbitmqconsumer.config.RabbitConfig;
import com.example.springbootrabbitmqconsumer.entity.Merchant;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @Author: Ah Nan
 * @Description: 消费者
 * @Date: 15:40 2020/6/24
 */
@Component
@RabbitListener(queues = RabbitConfig.firstQueue)
public class FirstConsumer {

    @RabbitHandler
    public void process(@Payload Merchant merchant){
        System.out.println("First Queue received msg : "+merchant.getMsg());
    }
}
